﻿namespace CheckIfTwoChessboardSquaresHaveTheSameColor
{
    public class Solution
    {
        public bool CheckTwoChessboards(string coordinate1, string coordinate2)
        {
            var c1 = this.ToCoordinateInt(coordinate1);
            var c2 = this.ToCoordinateInt(coordinate2);

            return (c1 % 2 == 0 && c2 % 2 == 0) || (c1 % 2 == 1 && c2 % 2 == 1);

        }

        private int ToCoordinateInt(string coordinate)
        {
            var column = (int)coordinate[0] - (int)'a';
            var row = (int)coordinate[1] - (int)'1';
            return column + row;

        }
    }
}
